package com.survivor.game;

import java.util.List;

import javax.microedition.khronos.opengles.GL;
import javax.microedition.khronos.opengles.GL10;

import android.graphics.Bitmap;
import android.opengl.GLUtils;

public class TextureLoader {
	
	public static void loadTextures(GL10 gl, List<Bitmap> bmpArray, int[] textures)
	{
		gl.glGenTextures(textures.length, textures, 0);
		
		for(int i = 0; i < textures.length; i++)
		{
			gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[i]);
			GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmpArray.get(i), 0);
			gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
			gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
			
			if(bmpArray.get(i) != null)
				bmpArray.get(i).recycle();
		}
		bmpArray = null;
	}

}
